# - Coding UTF8 -
#
# Networked Decision Making
# Site: http://code.google.com/p/global-decision-making-system/
#
# License Code: GPL, General Public License v. 2.0
# License Content: Creative Commons Attribution 3.0
#
# Also visit: www.web2py.com
#             or Groups: http://groups.google.com/group/web2py 
# 	For details on the web framework used for this development
#
# Developed by Russ King (newglobalstrategy@gmail.com
# Russ also blogs occasionally to pass the time at: 
# http://proudofyourplanent.blogspot.com
# His general thinking on why this project is very important is available at
# http://www.scribd.com/doc/98216626/New-Global-Strategy
# With thanks to Guido, Massimo and many other that make this sort of thing
# much easier than it used to be

# This is thoroughly inelegant but it only runs once so it will do for now

@auth.requires_membership('manager')
def subdivns():
#Unspecified Subdivision is already added - and not now adding this to every country

### US States
    if db(db.subdivision.subdiv_name == "Alabama").isempty():
        db.subdivision.insert(subdiv_name="Alabama", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Alaska").isempty():
        db.subdivision.insert(subdiv_name="Alaska", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "American Samoa").isempty():
        db.subdivision.insert(subdiv_name="American Samoa", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Arizona").isempty():
        db.subdivision.insert(subdiv_name="Arizona", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Arkansas").isempty():
        db.subdivision.insert(subdiv_name="Arkansas", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "California").isempty():
        db.subdivision.insert(subdiv_name="California", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Colorado").isempty():
        db.subdivision.insert(subdiv_name="Colorado", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Connecticut").isempty():
        db.subdivision.insert(subdiv_name="Connecticut", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Delaware").isempty():
        db.subdivision.insert(subdiv_name="Delaware", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "District of Columbia").isempty():
        db.subdivision.insert(subdiv_name="District of Columbia", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Florida").isempty():
        db.subdivision.insert(subdiv_name="Florida", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Georgia").isempty():
        db.subdivision.insert(subdiv_name="Georgia", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Guam").isempty():
        db.subdivision.insert(subdiv_name="Guam", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Hawaii").isempty():
        db.subdivision.insert(subdiv_name="Hawaii", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Idaho").isempty():
        db.subdivision.insert(subdiv_name="Idaho", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Illinois").isempty():
        db.subdivision.insert(subdiv_name="Illinois", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Indiana").isempty():
        db.subdivision.insert(subdiv_name="Indiana", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Iowa").isempty():
        db.subdivision.insert(subdiv_name="Iowa", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Kansas").isempty():
        db.subdivision.insert(subdiv_name="Kansas", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Kentucky").isempty():
        db.subdivision.insert(subdiv_name="Kentucky", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Louisiana").isempty():
        db.subdivision.insert(subdiv_name="Louisiana", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Maine").isempty():
        db.subdivision.insert(subdiv_name="Maine", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Maryland").isempty():
        db.subdivision.insert(subdiv_name="Maryland", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Massachusetts").isempty():
        db.subdivision.insert(subdiv_name="Massachusetts", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Michigan").isempty():
        db.subdivision.insert(subdiv_name="Michigan", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Minnesota").isempty():
        db.subdivision.insert(subdiv_name="Minnesota", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Mississippi").isempty():
        db.subdivision.insert(subdiv_name="Mississippi", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Missouri").isempty():
        db.subdivision.insert(subdiv_name="Missouri", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Montana").isempty():
        db.subdivision.insert(subdiv_name="Montana", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Nebraska").isempty():
        db.subdivision.insert(subdiv_name="Nebraska", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Nevada").isempty():
        db.subdivision.insert(subdiv_name="Nevada", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "New Hampshire").isempty():
        db.subdivision.insert(subdiv_name="New Hampshire", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "New Jersey").isempty():
        db.subdivision.insert(subdiv_name="New Jersey", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "New Mexico").isempty():
        db.subdivision.insert(subdiv_name="New Mexico", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "New York").isempty():
        db.subdivision.insert(subdiv_name="New York", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "North Carolina").isempty():
        db.subdivision.insert(subdiv_name="North Carolina", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "North Dakota").isempty():
        db.subdivision.insert(subdiv_name="North Dakota", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Northern Mariana Islands").isempty():
        db.subdivision.insert(subdiv_name="Northern Mariana Islands", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Ohio").isempty():
        db.subdivision.insert(subdiv_name="Ohio", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Oklahoma").isempty():
        db.subdivision.insert(subdiv_name="Oklahoma", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Oregon").isempty():
        db.subdivision.insert(subdiv_name="Oregon", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Pennsylvania").isempty():
        db.subdivision.insert(subdiv_name="Pennsylvania", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Puerto Rico").isempty():
        db.subdivision.insert(subdiv_name="Puerto Rico", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Rhode Island").isempty():
        db.subdivision.insert(subdiv_name="Rhode Island", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "South Carolina").isempty():
        db.subdivision.insert(subdiv_name="South Carolina", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "South Dakota").isempty():
        db.subdivision.insert(subdiv_name="South Dakota", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Tennessee").isempty():
        db.subdivision.insert(subdiv_name="Tennessee", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Texas").isempty():
        db.subdivision.insert(subdiv_name="Texas", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "U.S. Virgin Islands").isempty():
        db.subdivision.insert(subdiv_name="U.S. Virgin Islands", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Utah").isempty():
        db.subdivision.insert(subdiv_name="Utah", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Vermont").isempty():
        db.subdivision.insert(subdiv_name="Vermont", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Virginia").isempty():
        db.subdivision.insert(subdiv_name="Virginia", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Washington").isempty():
        db.subdivision.insert(subdiv_name="Washington", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "West Virginia").isempty():
        db.subdivision.insert(subdiv_name="West Virginia", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Wisconsin").isempty():
        db.subdivision.insert(subdiv_name="Wisconsin", country='United States (NA)') 
    if db(db.subdivision.subdiv_name == "Wyoming").isempty():
        db.subdivision.insert(subdiv_name="Wyoming", country='United States (NA)') 

###Canadian Provinces
    if db(db.subdivision.subdiv_name == "Alberta").isempty():
        db.subdivision.insert(subdiv_name="Alberta", country='Canada (NA)') 
    if db(db.subdivision.subdiv_name == "British Columbia").isempty():
        db.subdivision.insert(subdiv_name="British Columbia", country='Canada (NA)') 
    if db(db.subdivision.subdiv_name == "Manitoba").isempty():
        db.subdivision.insert(subdiv_name="Manitoba", country='Canada (NA)') 
    if db(db.subdivision.subdiv_name == "New Brunswick").isempty():
        db.subdivision.insert(subdiv_name="New Brunswick", country='Canada (NA)') 
    if db(db.subdivision.subdiv_name == "Newfoundland and Labrador").isempty():
        db.subdivision.insert(subdiv_name="Newfoundland and Labrador", country='Canada (NA)') 
    if db(db.subdivision.subdiv_name == "Nova Scotia").isempty():
        db.subdivision.insert(subdiv_name="Nova Scotia", country='Canada (NA)') 
    if db(db.subdivision.subdiv_name == "Ontario").isempty():
        db.subdivision.insert(subdiv_name="Ontario", country='Canada (NA)') 
    if db(db.subdivision.subdiv_name == "Prince Edward Island").isempty():
        db.subdivision.insert(subdiv_name="Prince Edward Island", country='Canada (NA)') 
    if db(db.subdivision.subdiv_name == "Quebec").isempty():
        db.subdivision.insert(subdiv_name="Quebec", country='Canada (NA)') 
    if db(db.subdivision.subdiv_name == "Saskatchewan").isempty():
        db.subdivision.insert(subdiv_name="Saskatchewan", country='Canada (NA)') 




    return locals()


@auth.requires_membership('manager')
def countries():

   # if db(db.country.country_name == "Unspecified").isempty():
   #     db.country.insert(country_name="Unspecified", continent = 'Asia (AS)')

    if db(db.country.country_name == "Afghanistan (AS)").isempty():
        db.country.insert(country_name="Afghanistan (AS)", continent = 'Asia (AS)')
    if db(db.country.country_name == "Albania (EU)").isempty():
        db.country.insert(country_name="Albania (EU)", continent = 'Europe (EU)')
    if db(db.country.country_name == "Algeria (AF)").isempty():
        db.country.insert(country_name="Algeria (AF)", continent =
'Africa (AF)')
    if db(db.country.country_name == "Andorra (EU)").isempty():
        db.country.insert(country_name="Andorra (EU)", continent =
'Europe (EU)')

    if db(db.country.country_name == "Angola (AF)").isempty():
        db.country.insert(country_name="Angola (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Antigua and Barbuda (NA)").isempty():
        db.country.insert(country_name="Antigua and Barbuda (NA)", continent = 
'North America (NA)')

    if db(db.country.country_name == "Argentina (SA)").isempty():
        db.country.insert(country_name="Argentina (SA)", continent = 'South America (SA)',isg20=True,leader="Cristina Fernández de Kirchner")


    if db(db.country.country_name == "Armenia (EU)").isempty():
        db.country.insert(country_name="Armenia (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Australia (OC)").isempty():
        db.country.insert(country_name="Australia (OC)", continent =  'Oceania (OC)',leader="Kevin Rudd")

    if db(db.country.country_name == "Austria (EU)").isempty():
        db.country.insert(country_name="Austria (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Azerbaijan (EU)").isempty():
        db.country.insert(country_name="Azerbaijan (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Bahamas (NA)").isempty():
        db.country.insert(country_name="Bahamas (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Bahrain (AS)").isempty():
        db.country.insert(country_name="Bahrain (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Bangladesh (AS)").isempty():
        db.country.insert(country_name="Bangladesh (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Barbados (NA)").isempty():
        db.country.insert(country_name="Barbados (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Belarus (EU)").isempty():
        db.country.insert(country_name="Belarus (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Belgium (EU)").isempty():
        db.country.insert(country_name="Belgium (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Belize (NA)").isempty():
        db.country.insert(country_name="Belize (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Benin (AF)").isempty():
        db.country.insert(country_name="Benin (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Bhutan (AS)").isempty():
        db.country.insert(country_name="Bhutan (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Bolivia (SA)").isempty():
        db.country.insert(country_name="Bolivia (SA)", continent = 
'South America (SA)')
    if db(db.country.country_name == "Bosnia and Herzegovina (EU)").isempty():
        db.country.insert(country_name="Bosnia and Herzegovina (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Botswana (AF)").isempty():
        db.country.insert(country_name="Botswana (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Brazil (SA)").isempty():
        db.country.insert(country_name="Brazil (SA)", continent =  'South America (SA)',isg20=True,leader="Dilma Rousseff")

    if db(db.country.country_name == "Brunei (AS)").isempty():
        db.country.insert(country_name="Brunei (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Bulgaria (EU)").isempty():
        db.country.insert(country_name="Bulgaria (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Burkina (AF)").isempty():
        db.country.insert(country_name="Burkina (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Burma (Myanmar) (AS)").isempty():
        db.country.insert(country_name="Burma (Myanmar) (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Burundi (AF)").isempty():
        db.country.insert(country_name="Burundi (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Cambodia (AS)").isempty():
        db.country.insert(country_name="Cambodia (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Cameroon (AF)").isempty():
        db.country.insert(country_name="Cameroon (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Canada (NA)").isempty():
        db.country.insert(country_name="Canada (NA)", continent =  'North America (NA)',isg20=True,leader="Stephen Harper")

    if db(db.country.country_name == "Cape Verde (AF)").isempty():
        db.country.insert(country_name="Cape Verde (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Central African Republic (AF)").isempty():
        db.country.insert(country_name="Central African Republic (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Chad (AF)").isempty():
        db.country.insert(country_name="Chad (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Chile (SA)").isempty():
        db.country.insert(country_name="Chile (SA)", continent = 
'South America (SA)')
    if db(db.country.country_name == "China (AS)").isempty():
        db.country.insert(country_name="China (AS)", continent =  'Asia (AS)',isg20=True,leader="Xi Jinping")

    if db(db.country.country_name == "Colombia (SA)").isempty():
        db.country.insert(country_name="Colombia (SA)", continent = 
'South America (SA)')
    if db(db.country.country_name == "Comoros (AF)").isempty():
        db.country.insert(country_name="Comoros (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Congo (AF)").isempty():
        db.country.insert(country_name="Congo (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Congo, Democratic Republic of (AF)").isempty():
        db.country.insert(country_name="Congo, Democratic Republic of (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Costa Rica (NA)").isempty():
        db.country.insert(country_name="Costa Rica (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Croatia (EU)").isempty():
        db.country.insert(country_name="Croatia (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Cuba (NA)").isempty():
        db.country.insert(country_name="Cuba (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Cyprus (EU)").isempty():
        db.country.insert(country_name="Cyprus (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Czech Republic (EU)").isempty():
        db.country.insert(country_name="Czech Republic (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Denmark (EU)").isempty():
        db.country.insert(country_name="Denmark (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Djibouti (AF)").isempty():
        db.country.insert(country_name="Djibouti (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Dominica (NA)").isempty():
        db.country.insert(country_name="Dominica (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Dominican Republic (NA)").isempty():
        db.country.insert(country_name="Dominican Republic (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "East Timor (AS)").isempty():
        db.country.insert(country_name="East Timor (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Ecuador (SA)").isempty():
        db.country.insert(country_name="Ecuador (SA)", continent = 
'South America (SA)')
    if db(db.country.country_name == "Egypt (AF)").isempty():
        db.country.insert(country_name="Egypt (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "El Salvador (NA)").isempty():
        db.country.insert(country_name="El Salvador (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Equatorial Guinea (AF)").isempty():
        db.country.insert(country_name="Equatorial Guinea (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Eritrea (AF)").isempty():
        db.country.insert(country_name="Eritrea (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Estonia (EU)").isempty():
        db.country.insert(country_name="Estonia (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Ethiopia (AF)").isempty():
        db.country.insert(country_name="Ethiopia (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Fiji (OC)").isempty():
        db.country.insert(country_name="Fiji (OC)", continent = 
'Oceania (OC)')
    if db(db.country.country_name == "Finland (EU)").isempty():
        db.country.insert(country_name="Finland (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "France (EU)").isempty():
        db.country.insert(country_name="France (EU)", continent =  'Europe (EU)',isg20=True,leader="Francois Hollande")

    if db(db.country.country_name == "Gabon (AF)").isempty():
        db.country.insert(country_name="Gabon (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Gambia (AF)").isempty():
        db.country.insert(country_name="Gambia (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Georgia (EU)").isempty():
        db.country.insert(country_name="Georgia (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Germany (EU)").isempty():
        db.country.insert(country_name="Germany (EU)", continent = 'Europe (EU)',isg20=True,leader="Angela Merkel")

    if db(db.country.country_name == "Ghana (AF)").isempty():
        db.country.insert(country_name="Ghana (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Greece (EU)").isempty():
        db.country.insert(country_name="Greece (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Grenada (NA)").isempty():
        db.country.insert(country_name="Grenada (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Guatemala (NA)").isempty():
        db.country.insert(country_name="Guatemala (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Guinea (AF)").isempty():
        db.country.insert(country_name="Guinea (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Guinea-Bissau (AF)").isempty():
        db.country.insert(country_name="Guinea-Bissau (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Guyana (SA)").isempty():
        db.country.insert(country_name="Guyana (SA)", continent = 
'South America (SA)')
    if db(db.country.country_name == "Haiti (NA)").isempty():
        db.country.insert(country_name="Haiti (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Honduras (NA)").isempty():
        db.country.insert(country_name="Honduras (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Hungary (EU)").isempty():
        db.country.insert(country_name="Hungary (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Iceland (EU)").isempty():
        db.country.insert(country_name="Iceland (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "India (AS)").isempty():
        db.country.insert(country_name="India (AS)", continent =  'Asia (AS)',isg20=True,leader="Shri Pranab Mukherjee")

    if db(db.country.country_name == "Indonesia (AS)").isempty():
        db.country.insert(country_name="Indonesia (AS)", continent = 'Asia (AS)',isg20=True,leader="Susilo Bambang Yudhoyono.")

    if db(db.country.country_name == "Iran (AS)").isempty():
        db.country.insert(country_name="Iran (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Iraq (AS)").isempty():
        db.country.insert(country_name="Iraq (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Ireland (EU)").isempty():
        db.country.insert(country_name="Ireland (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Israel (AS)").isempty():
        db.country.insert(country_name="Israel (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Italy (EU)").isempty():
        db.country.insert(country_name="Italy (EU)", continent =  'Europe (EU)',isg20=True,leader="Enrico Letta")

    if db(db.country.country_name == "Ivory Coast (AF)").isempty():
        db.country.insert(country_name="Ivory Coast (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Jamaica (NA)").isempty():
        db.country.insert(country_name="Jamaica (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Japan (AS)").isempty():
        db.country.insert(country_name="Japan (AS)", continent =  'Asia (AS)',isg20=True,leader="Shinzo Abe")

    if db(db.country.country_name == "Jordan (AS)").isempty():
        db.country.insert(country_name="Jordan (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Kazakhstan (AS)").isempty():
        db.country.insert(country_name="Kazakhstan (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Kenya (AF)").isempty():
        db.country.insert(country_name="Kenya (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Kiribati (OC)").isempty():
        db.country.insert(country_name="Kiribati (OC)", continent = 'Oceania (OC)')

    if db(db.country.country_name == "Korea, North (AS)").isempty():
        db.country.insert(country_name="Korea, North (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Korea, South (AS)").isempty():
        db.country.insert(country_name="Korea, South (AS)", continent =  'Asia (AS)',isg20=True,leader="Park Geun-hye")

    if db(db.country.country_name == "Kuwait (AS)").isempty():
        db.country.insert(country_name="Kuwait (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Kyrgyzstan (AS)").isempty():
        db.country.insert(country_name="Kyrgyzstan (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Laos (AS)").isempty():
        db.country.insert(country_name="Laos (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Latvia (EU)").isempty():
        db.country.insert(country_name="Latvia (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Lebanon (AS)").isempty():
        db.country.insert(country_name="Lebanon (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Lesotho (AF)").isempty():
        db.country.insert(country_name="Lesotho (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Liberia (AF)").isempty():
        db.country.insert(country_name="Liberia (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Libya (AF)").isempty():
        db.country.insert(country_name="Libya (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Liechtenstein (EU)").isempty():
        db.country.insert(country_name="Liechtenstein (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Lithuania (EU)").isempty():
        db.country.insert(country_name="Lithuania (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Luxembourg (EU)").isempty():
        db.country.insert(country_name="Luxembourg (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Macedonia (EU)").isempty():
        db.country.insert(country_name="Macedonia (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Madagascar (AF)").isempty():
        db.country.insert(country_name="Madagascar (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Malawi (AF)").isempty():
        db.country.insert(country_name="Malawi (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Malaysia (AS)").isempty():
        db.country.insert(country_name="Malaysia (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Maldives (AS)").isempty():
        db.country.insert(country_name="Maldives (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Mali (AF)").isempty():
        db.country.insert(country_name="Mali (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Malta (EU)").isempty():
        db.country.insert(country_name="Malta (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Marshall Islands (OC)").isempty():
        db.country.insert(country_name="Marshall Islands (OC)", continent = 'Oceania (OC)')
    if db(db.country.country_name == "Mauritania (AF)").isempty():
        db.country.insert(country_name="Mauritania (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Mauritius (AF)").isempty():
        db.country.insert(country_name="Mauritius (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Mexico (NA)").isempty():
        db.country.insert(country_name="Mexico (NA)", continent = 'North America (NA)',isg20=True,leader="Enrique Peña Nieto")

    if db(db.country.country_name == "Micronesia (OC)").isempty():
        db.country.insert(country_name="Micronesia (OC)", continent = 
'Oceania (OC)')
    if db(db.country.country_name == "Moldova (EU)").isempty():
        db.country.insert(country_name="Moldova (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Monaco (EU)").isempty():
        db.country.insert(country_name="Monaco (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Mongolia (AS)").isempty():
        db.country.insert(country_name="Mongolia (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Montenegro (EU)").isempty():
        db.country.insert(country_name="Montenegro (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Morocco (AF)").isempty():
        db.country.insert(country_name="Morocco (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Mozambique (AF)").isempty():
        db.country.insert(country_name="Mozambique (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Namibia (AF)").isempty():
        db.country.insert(country_name="Namibia (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Nauru (OC)").isempty():
        db.country.insert(country_name="Nauru (OC)", continent = 
'Oceania (OC)')
    if db(db.country.country_name == "Nepal (AS)").isempty():
        db.country.insert(country_name="Nepal (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Netherlands (EU)").isempty():
        db.country.insert(country_name="Netherlands (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "New Zealand (OC)").isempty():
        db.country.insert(country_name="New Zealand (OC)", continent = 
'Oceania (OC)')
    if db(db.country.country_name == "Nicaragua (NA)").isempty():
        db.country.insert(country_name="Nicaragua (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Niger (AF)").isempty():
        db.country.insert(country_name="Niger (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Nigeria (AF)").isempty():
        db.country.insert(country_name="Nigeria (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Norway (EU)").isempty():
        db.country.insert(country_name="Norway (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Oman (AS)").isempty():
        db.country.insert(country_name="Oman (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Pakistan (AS)").isempty():
        db.country.insert(country_name="Pakistan (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Palau (OC)").isempty():
        db.country.insert(country_name="Palau (OC)", continent = 
'Oceania (OC)')
    if db(db.country.country_name == "Panama (NA)").isempty():
        db.country.insert(country_name="Panama (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Papua New Guinea (OC)").isempty():
        db.country.insert(country_name="Papua New Guinea (OC)", continent = 
'Oceania (OC)')
    if db(db.country.country_name == "Paraguay (SA)").isempty():
        db.country.insert(country_name="Paraguay (SA)", continent = 
'South America (SA)')
    if db(db.country.country_name == "Peru (SA)").isempty():
        db.country.insert(country_name="Peru (SA)", continent = 
'South America (SA)')
    if db(db.country.country_name == "Philippines (AS)").isempty():
        db.country.insert(country_name="Philippines (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Poland (EU)").isempty():
        db.country.insert(country_name="Poland (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Portugal (EU)").isempty():
        db.country.insert(country_name="Portugal (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Qatar (AS)").isempty():
        db.country.insert(country_name="Qatar (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Romania (EU)").isempty():
        db.country.insert(country_name="Romania (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Russian Federation (AS)").isempty():
        db.country.insert(country_name="Russian Federation (AS)", continent = 'Asia (AS)',isg20=True,leader="Vladimir Putin")

    if db(db.country.country_name == "Rwanda (AF)").isempty():
        db.country.insert(country_name="Rwanda (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Saint Kitts and Nevis (NA)").isempty():
        db.country.insert(country_name="Saint Kitts and Nevis (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Saint Lucia (NA)").isempty():
        db.country.insert(country_name="Saint Lucia (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Saint Vincent and the Grenadines (NA)").isempty():
        db.country.insert(country_name="Saint Vincent and the Grenadines (NA)", continent = 
'North America (NA)')
    if db(db.country.country_name == "Samoa (OC)").isempty():
        db.country.insert(country_name="Samoa (OC)", continent = 
'Oceania (OC)')
    if db(db.country.country_name == "San Marino (EU)").isempty():
        db.country.insert(country_name="San Marino (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Sao Tome and Principe (AF)").isempty():
        db.country.insert(country_name="Sao Tome and Principe (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Saudi Arabia (AS)").isempty():
        db.country.insert(country_name="Saudi Arabia (AS)", continent =  'Asia (AS)',isg20=True,leader="Abdullah bin Abdulaziz Al Saud")

    if db(db.country.country_name == "Senegal (AF)").isempty():
        db.country.insert(country_name="Senegal (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Serbia (EU)").isempty():
        db.country.insert(country_name="Serbia (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Seychelles (AF)").isempty():
        db.country.insert(country_name="Seychelles (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Sierra Leone (AF)").isempty():
        db.country.insert(country_name="Sierra Leone (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Singapore (AS)").isempty():
        db.country.insert(country_name="Singapore (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Slovakia (EU)").isempty():
        db.country.insert(country_name="Slovakia (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Slovenia (EU)").isempty():
        db.country.insert(country_name="Slovenia (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Solomon Islands (OC)").isempty():
        db.country.insert(country_name="Solomon Islands (OC)", continent = 
'Oceania (OC)')
    if db(db.country.country_name == "Somalia (AF)").isempty():
        db.country.insert(country_name="Somalia (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "South Africa (AF)").isempty():
        db.country.insert(country_name="South Africa (AF)", continent = 'Africa (AF)',isg20=True,leader="Jacob Gedleyihlekisa Zuma")

    if db(db.country.country_name == "South Sudan (AF)").isempty():
        db.country.insert(country_name="South Sudan (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Spain (EU)").isempty():
        db.country.insert(country_name="Spain (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Sri Lanka (AS)").isempty():
        db.country.insert(country_name="Sri Lanka (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Sudan (AF)").isempty():
        db.country.insert(country_name="Sudan (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Suriname (SA)").isempty():
        db.country.insert(country_name="Suriname (SA)", continent = 
'South America (SA)')
    if db(db.country.country_name == "Swaziland (AF)").isempty():
        db.country.insert(country_name="Swaziland (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Sweden (EU)").isempty():
        db.country.insert(country_name="Sweden (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Switzerland (EU)").isempty():
        db.country.insert(country_name="Switzerland (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Syria (AS)").isempty():
        db.country.insert(country_name="Syria (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Tajikistan (AS)").isempty():
        db.country.insert(country_name="Tajikistan (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Tanzania (AF)").isempty():
        db.country.insert(country_name="Tanzania (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Thailand (AS)").isempty():
        db.country.insert(country_name="Thailand (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Togo (AF)").isempty():
        db.country.insert(country_name="Togo (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Tonga (OC)").isempty():
        db.country.insert(country_name="Tonga (OC)", continent = 
'Oceania (OC)')
    if db(db.country.country_name == "Trinidad and Tobago (NA)").isempty():
        db.country.insert(country_name="Trinidad and Tobago (NA)", continent = 
        
'North America (NA)')
    if db(db.country.country_name == "Tunisia (AF)").isempty():
        db.country.insert(country_name="Tunisia (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Turkey (AS)").isempty():
        db.country.insert(country_name="Turkey (AS)", continent =  'Asia (AS)',isg20=True,leader="Abdullah Gül")

    if db(db.country.country_name == "Turkmenistan (AS)").isempty():
        db.country.insert(country_name="Turkmenistan (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Tuvalu (OC)").isempty():
        db.country.insert(country_name="Tuvalu (OC)", continent = 
'Oceania (OC)')
    if db(db.country.country_name == "Uganda (AF)").isempty():
        db.country.insert(country_name="Uganda (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Ukraine (EU)").isempty():
        db.country.insert(country_name="Ukraine (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "United Arab Emirates (AS)").isempty():
        db.country.insert(country_name="United Arab Emirates (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "United Kingdom (EU)").isempty():
        db.country.insert(country_name="United Kingdom (EU)", continent = 'Europe (EU)',isg20=True,leader="David Cameron")

    if db(db.country.country_name == "United States (NA)").isempty():
        db.country.insert(country_name="United States (NA)", continent = 'North America (NA)',isg20=True,leader="Barrack Obama")

    if db(db.country.country_name == "Uruguay (SA)").isempty():
        db.country.insert(country_name="Uruguay (SA)", continent = 
'South America (SA)')
    if db(db.country.country_name == "Uzbekistan (AS)").isempty():
        db.country.insert(country_name="Uzbekistan (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Vanuatu (OC)").isempty():
        db.country.insert(country_name="Vanuatu (OC)", continent = 
'Oceania (OC)')
    if db(db.country.country_name == "Vatican City (EU)").isempty():
        db.country.insert(country_name="Vatican City (EU)", continent = 
  'Europe (EU)')
    if db(db.country.country_name == "Venezuela (SA)").isempty():
        db.country.insert(country_name="Venezuela (SA)", continent = 
'South America (SA)')
    if db(db.country.country_name == "Vietnam (AS)").isempty():
        db.country.insert(country_name="Vietnam (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Yemen (AS)").isempty():
        db.country.insert(country_name="Yemen (AS)", continent = 
  'Asia (AS)')
    if db(db.country.country_name == "Zambia (AF)").isempty():
        db.country.insert(country_name="Zambia (AF)", continent = 
  'Africa (AF)')
    if db(db.country.country_name == "Zimbabwe (AF)").isempty():
        db.country.insert(country_name="Zimbabwe (AF)", continent = 
  'Africa (AF)')

    return locals()

@auth.requires_membership('manager')
def individual():
    if db(db.individual.leader == "Amancio Ortega").isempty():
        db.individual.insert(leader="Amancio Ortega")
    if db(db.individual.leader == "Bernard Arnault").isempty():
        db.individual.insert(leader="Bernard Arnault")
    if db(db.individual.leader == "Bill Gates").isempty():
        db.individual.insert(leader="Bill Gates")
    if db(db.individual.leader == "Carlos Slim").isempty():
        db.individual.insert(leader="Carlos Slim")
    if db(db.individual.leader == "Charles Koch").isempty():
        db.individual.insert(leader="Charles Koch")
    if db(db.individual.leader == "David Koch").isempty():
        db.individual.insert(leader="David Koch")
    if db(db.individual.leader == "Larry Ellison").isempty():
        db.individual.insert(leader="Larry Ellison")
    if db(db.individual.leader == "Li Ka-shing").isempty():
        db.individual.insert(leader="Li Ka-shing")
    if db(db.individual.leader == "Liliane Bettencourt").isempty():
        db.individual.insert(leader="Liliane Bettencourt")
    if db(db.individual.leader == "Warren Buffett").isempty():
        db.individual.insert(leader="Warren Buffett")


    return locals()


@auth.requires_membership('manager')
def company():
    if db(db.company.company_name == "BP").isempty():
        db.company.insert(company_name="BP", leader="Bob Dudley")
    if db(db.company.company_name == "Chevron").isempty():
        db.company.insert(company_name="Chevron", leader="John Watson")
    if db(db.company.company_name == "China National Petroleum Corporation").isempty():
        db.company.insert(company_name="China National Petroleum Corporation", leader="tbc")
    if db(db.company.company_name == "ConocoPhillips").isempty():
        db.company.insert(company_name="ConocoPhillips", leader="Ryan Lance")
    if db(db.company.company_name == "ExxonMobil").isempty():
        db.company.insert(company_name="ExxonMobil", leader="Rex Tillerson")
    if db(db.company.company_name == "Royal Dutch Shell").isempty():
        db.company.insert(company_name="Royal Dutch Shell", leader="Peter Voser")
    if db(db.company.company_name == "Sinopec").isempty():
        db.company.insert(company_name="Sinopec", leader="tbc")
    if db(db.company.company_name == "State Grid Corporation of China").isempty():
        db.company.insert(company_name="State Grid Corporation of China", leader="tbc")
    if db(db.company.company_name == "Toyota").isempty():
        db.company.insert(company_name="Toyota", leader="Katsuaki Watanabe")
    if db(db.company.company_name == "Walmart").isempty():
        db.company.insert(company_name="Walmart", leader="Mike Duke")


    return locals()



